/*
*
* vue 插件 (加载，弹窗)
* */
import vue from "vue";
import Popup from  "../components/popup"

let PopupComponent = vue.extend(Popup);
let Plugin = {};

Plugin.install = function(Vue, option){

    Vue.prototype.$alert = function(content, fn){
        let vm = new PopupComponent().$mount();
        vm.open = true;
        vm.content = content;
        vm.close = function(){
           
            vm.open = false;
        }
        vm.alertModle = function(){

            fn?fn(vm):vm.close()
        };

        document.body.append(vm.$el)
    }

}


export default Plugin